#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "pet.h"
#include "timemanager.h"
#include <QMainWindow>
#include <QStringList>
#include <QRandomGenerator>
#include <QMouseEvent>
#include <QPixmap>

QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

protected:
    void mousePressEvent(QMouseEvent *event) override;

private slots:
    void startButtonClick();
    void confirmButtonClick();
    void feedButtonClick();
    void cleanButtonClick();
    void playButtonClick();

    //更新
    void updateTime();
    void updateStatus();
    void backToMainButton();
    void petLevelUp(int level);
    void updatePetImage();
    void timeTick();

    //吃
    void showRandomDialog();
    void cakeButtonClick();
    void hambButtonClick();
    void eggButtonClick();
    void handleFoodDrop(const QString &food);

    //玩耍
    void showRandomPlayDialog();
    void singButtonClick();
    void layButtonClick();
    void celebrateButtonClick();
    void handlePlayAction(const QString &action);

    void levelUpButtonClick(); //升级
    void exitButtonClick(); //退出
    void gameIsOver(); //通关
    void replayButtonClick();

    void randomButtonLayout(QWidget *pageWidget);

private:
    Ui::MainWindow *ui;
    Pet *m_pet;
    TimeManager *m_timeManager;

    QStringList foodDialog;
    QStringList playDialog;
    int clickCount;
    int progressValue;
    bool isBathFinish;
};

#endif // MAINWINDOW_H
